package com.yida.gwj.api.service;

import com.yida.gwj.api.domain.dto.GwjExpendHouseAndOwnerDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.yida.common.core.constant.SecurityConstants;
import com.yida.common.core.constant.ServiceNameConstants;
import com.yida.common.core.domain.R;
import com.yida.gwj.api.domain.GwjMaintenanceFundsBusinessInner;
import com.yida.gwj.api.domain.request.GwjExpendOutSideAllocatedAmountHouseRequest;
import com.yida.gwj.api.factory.RemoteGwjExpendFallbackFactory;

import java.util.List;

/**
 * @author hmh
 * @date 2023/06/14
 */
@FeignClient(contextId = "remoteGwjExpendService", value = ServiceNameConstants.GWJ_EXPEND_OUTSIDE_SERVICE, fallbackFactory = RemoteGwjExpendFallbackFactory.class)
public interface RemoteGwjExpendService {

    /**
     * 20230613
     * 
     * 根据业务编号和地区查询工程预算书
     * 
     * @param bizNum
     * @param areaId
     * @return
     */
    @GetMapping("/expend/outside/expendImg/")
    // public R<List<GwjMaintenanceFundsBusinessAttachment>> expendImg(@RequestParam("bizNum") Long bizNum,
    // @RequestParam("areaId") Long areaId);
    public R<JSONArray> expendImg(@RequestParam("bizNum") Long bizNum, @RequestParam("areaId") Long areaId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 20230613
     * 
     * 根据业务编号和地区查询维修和更新、改造方案
     * 
     * @param bizNum
     * @param areaId
     * @return
     */
    @GetMapping("/expend/outside/expendFile/")
    public R<JSONObject> expendFile(@RequestParam("bizNum") Long bizNum, @RequestParam("areaId") Long areaId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 20230703
     * 
     * 查询已选中房屋分摊范围及金额
     * 
     * @param gwjExpendOutSideAllocatedAmountHouseRequest 外网房屋数据请求对象
     * @param source
     * @return
     */
    @PostMapping("/expend/outside/expendBusinessHouse/")
    public R<JSONObject> expendBusinessHouse(@RequestBody GwjExpendOutSideAllocatedAmountHouseRequest gwjExpendOutSideAllocatedAmountHouseRequest, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 20230703
     *
     * 查询未选中房屋
     *
     * @param bizNum
     * @param areaId
     * @return
     */
    @PostMapping("/expend/outside/expendBusinessHouse/unselected/")
    public R<JSONObject> expendBusinessHouseUnselected(@RequestBody GwjExpendOutSideAllocatedAmountHouseRequest gwjExpendOutSideAllocatedAmountHouseRequest, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 20230613
     *
     * 查询业务楼栋信息
     *
     * @param bizNum
     * @param areaId
     * @return
     */
    @GetMapping("/expend/outside/expendBusinessBuilds/")

    public R<JSONArray> expendBusinessBuilds(@RequestParam("bizNum") Long bizNum, @RequestParam("areaId") Long areaId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/expend/innerGetInfo/{bizId}")
    public R<GwjMaintenanceFundsBusinessInner> getMaintenanceFundsBusinessInfoByBizId(@PathVariable("bizId") Long bizId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 步骤回调
     * @param jsonMsg 请求参数
     * @param source 内部标识
     * @return
     */
    @GetMapping("/expend/outside/resultNotify")
    R<Boolean> resultNotify(@RequestParam("jsonMsg") String jsonMsg,@RequestHeader(SecurityConstants.FROM_SOURCE) String source );


    /**
     * 回退步骤回调
     * @param jsonMsg 请求参数
     * @param source 内部标识
     * @return
     */
    @GetMapping("/expend/outside/rollback/resultNotify")
    R<Boolean> rollbackResultNotify(@RequestParam("jsonMsg")String jsonMsg,@RequestHeader(SecurityConstants.FROM_SOURCE) String source );

    /**
     * 预受理审核通过
     * @param jsonMsg 请求参数
     * @param source 内部标识
     * @return
     */
    @GetMapping("/expend/outside/preAcceptExamine")
    R<Boolean> preAcceptExamine(@RequestParam("jsonMsg") String jsonMsg,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 查询房屋业主投票列表
     * @param outServerIdentification 业务标识
     * @param source 内部标识
     * @return
     */
    @GetMapping("/house/info/selectHouseAndOwnerVoteInfo/{outServerIdentification}")
    R<List<GwjExpendHouseAndOwnerDTO>> selectHouseAndOwnerVoteInfo(@PathVariable("outServerIdentification") String outServerIdentification, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 业主证明内部调用
     * @param outServerIdentification 业务标识
     * @param source 内部标识
     * @return
     */
    @GetMapping("/expend/outside/ownerCheckInner")
    R<JSONObject> ownerCheckInner(@RequestParam("outServerIdentification") String outServerIdentification,@RequestParam("bizFlagId") Integer bizFlagId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
